package cn.com.ns.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.servlet.http.HttpServletRequest;

import cn.com.ns.annotation.Controller;
import cn.com.ns.annotation.RequestMapping;
import cn.com.ns.annotation.RequestParam;
import cn.com.ns.annotation.ResponseBody;
import cn.com.ns.util.View;
import cn.com.ns.util.WebContext;

@Controller
public class TestController {
	
	@RequestMapping(value = "/test")
	public View test(@RequestParam(value = "userName")String userName,@RequestParam(value="password")String password){

        HttpServletRequest request = WebContext.requestHodler.get();



        //执行完forward1方法之后返回的视图
        return new View("/Login2.jsp");

	}
	
	@RequestMapping(value = "/test1")
	@ResponseBody
	public List<String> test1(){
		List<String> list = new ArrayList<>();
		list.add("111");
		return list;
	}
	
	@RequestMapping(value = "/test2")
	@ResponseBody
	public String test2(){
		
		return "111";
	}
	
	@RequestMapping(value = "/test3")
	@ResponseBody
	public Map<String,Object> test3(){
		Map<String,Object> map = new HashMap<String,Object>();
		List<String> list = new ArrayList();
		list.add("222");
		map.put("key",list);
		return map;
	}
}

class TestObj{
	private String obj1;
	
	private String obj2;

	public String getObj1() {
		return obj1;
	}

	public void setObj1(String obj1) {
		this.obj1 = obj1;
	}

	public String getObj2() {
		return obj2;
	}

	public void setObj2(String obj2) {
		this.obj2 = obj2;
	}
	
	
}
